package com.work.api.main;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.work.dto.main.TShipBillRemarkSearchDTO;
import com.work.dto.main.TShipBillRemarkSubmitDTO;
import com.work.service.main.ITShipBillRemarkService;
import com.work.vo.main.TShipBillRemarkVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 理货舱单交班记录控制器
 *
 * @author ：dujianyu
 * @since ：Created in 2024/3/25 8:45
 */
@RestController
@AllArgsConstructor
@RequestMapping("tShipBillRemark")
@Api(value = "理货舱单交班记录控制器", tags = "理货舱单交班记录控制器")
public class TShipBillRemarkController extends BladeController {

    private ITShipBillRemarkService service;

    @PostMapping("/submit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "提交", notes = "传入dto")
    public R<Boolean> submit(@Valid @RequestBody TShipBillRemarkSubmitDTO dto) {
        return R.status(service.submitShipBillRemark(dto));
    }

    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "列表", notes = "传入dto")
    public R<List<TShipBillRemarkVO>> list(TShipBillRemarkSearchDTO dto) {
        return R.data(service.selectShipBillRemarkList(dto));
    }

    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入dto")
    public R<IPage<TShipBillRemarkVO>> list(TShipBillRemarkSearchDTO dto, Query query) {
        return R.data(service.selectShipBillRemarkPage(Condition.getPage(query), dto));
    }

}
